Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cluster-autoscaler] Allow “custom” DaemonSet pods #2483

Merged

Conversation

clamoriniere
Copy link
Contributor

@clamoriniere clamoriniere commented Oct 25, 2019

Fixes: #2453

  • Create utils/pod package: pod kind detection functions.
  • Update DaemonSet Pod detection logic: introduce the annotation
    cluster-autoscaler.kubernetes.io/daemonset-pod to declare a Pod as a
    DaemonSet Pod.
  • Update simulator package to use the new utils/pod package functions.
  • Cleanup getRequiredPodsForNode() function.

Signed-off-by: cedric lamoriniere [email protected]

@k8s-ci-robot
Copy link
Contributor

Welcome @clamoriniere!

It looks like this is your first PR to kubernetes/autoscaler 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/autoscaler has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 25, 2019
@clamoriniere clamoriniere force-pushed the feature/customdaemonsetsupport branch 2 times, most recently from fa536d4 to 7233004 Compare October 28, 2019 07:44
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Oct 28, 2019
@clamoriniere
Copy link
Contributor Author

clamoriniere commented Oct 30, 2019

Hi @losipiuk @seh could you have a look to this PR? it follows the discussion that we have in #2453
cheers,

Copy link
Contributor

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for delay in review. This looks great.
It is super nice to see added testing coverage and code cleanup going together with adding features.

I have very few minor comments.

continue
}

if pod_util.IsMirrorPod(pod) || pod_util.IsDaemonSetPod(pod) || pod_util.IsStaticPod(pod) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC the mirror pod is manifestation of static pod registered in API server. Static pod is observed only by kubelet so we should not get a static pod ever here. Right?

https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

absolutely

return true
}

if pod.Annotations == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you do not need this. Looking up in "nil" map should work fine.

podsToRemoveList, err := drain.GetPodsForDeletionOnNodeDrain(
allPods,
[]*policyv1.PodDisruptionBudget{}, // PDBs are irrelevant when considering new node.
true, // Force all removals.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we can drop the deleteAll parameter from GetPodsForDeletionOnNodeDrain

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, it is always used with false

@clamoriniere clamoriniere force-pushed the feature/customdaemonsetsupport branch from 7233004 to 55d8f42 Compare November 6, 2019 10:10
Copy link
Contributor

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks.

Please squash commits and I will lgtm.

@MaciekPytel do you want to take a look?

* Create `utils/pod` package: pod kind detection functions.
* Update DaemonSet Pod detection logic: introduce the annotation
  `cluster-autoscaler.kubernetes.io/daemonset-pod` to declare a Pod as a
  DaemonSet Pod.
* Update `simulator` package to use the new `utils/pod` package function.
* Cleanup `getRequiredPodsForNode()` function.

Signed-off-by: cedric lamoriniere <[email protected]>
@clamoriniere clamoriniere force-pushed the feature/customdaemonsetsupport branch from 55d8f42 to f0fbf7a Compare November 6, 2019 10:23
@clamoriniere
Copy link
Contributor Author

@losipiuk Thanks for the fast review.

Commits are now squashed.

@losipiuk
Copy link
Contributor

losipiuk commented Nov 6, 2019

/lgtm
/approve
Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 6, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: losipiuk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 6, 2019
@k8s-ci-robot k8s-ci-robot merged commit 3a030dd into kubernetes:master Nov 6, 2019
@clamoriniere clamoriniere deleted the feature/customdaemonsetsupport branch November 6, 2019 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support custom Daemonset Pods
3 participants